<!--
 * @version: 
 * @Company: 
 * @Description: 
 * @FilePath: \src\components\Custom\TableSelect\index.vue
-->

<template>
  <Alert type="info" show-icon>
    <template #message>
      <template v-if="selectRows.length > 0">
        <span>已选中{{ selectRows.length }}条记录</span>
        <a-button type="link" @click="handleClear" size="small">清空</a-button>
      </template>
      <template v-else>
        <span>未选中任何数据</span>
      </template>
    </template>
  </Alert>
</template>
<script lant="ts">
  import { defineComponent, ref, toRaw, reactive, toRefs } from 'vue';
  import { Alert } from 'ant-design-vue';
  export default defineComponent({
    name: 'TableSelect',
    components: { Alert },
    props: {
      selectRows: {
        type: Array,
        required: true,
        default: () => [],
      },
    },
    setup(props, { emit }) {
      const { selectRows } = toRefs(props);
      const handleClear = () => emit('clear');
      return {
        selectRows,
        handleClear,
      };
    },
  });
</script>
